<?php 
 
if(!isset($_GET['id'])){echo"DATA BELUM TERSEDIA"; exit;}
$karyawan = loaddata_karyawan($_GET['id']);
if(!$karyawan){echo"DATA BELUM TERSEDIA"; exit;}
$photo = my_get_data_by_id('photo','biodata_id',$karyawan['biodata_id']);


function data_kesehatan(){
	$view  = ' '; 
	$header = array(  );
	$header[' '] =array('style'=>'border-top:2px solid;border-bottom:2px solid;width:3%') ; 
	$header['tahun'] =array('style'=>'border-top:2px solid;border-bottom:2px solid;width:17%') ; 
	$header['Penyakit '] =array('style'=>'border-top:2px solid;border-bottom:2px solid;width:60%') ; 
	$header['kesembuhan'] =array('style'=>'border-top:2px solid;border-bottom:2px solid;width:20%') ; 
	
	
	$row = array(); 
	$kesehatans = loaddata_kesehatan_karyawan($_GET['id']);
	$n=1;
	foreach($kesehatans as $ddata  ){
		 
		$row[] = array(
			'#'=> $n,  
			'tahun'=>  $ddata['tahun_sakit'] , 
			'penyk'=>ucfirst($ddata['penyakit']) ,  
			'nik'=>  ucfirst($ddata['kesembuhan'] ), 
		); $n++;
	}	
	$datas = table_cetak_rows($row);
	$view .= table_cetak_builder($header , $datas ,  4  );
	return $view;
}

function data_hobi(){
	$view  = ' '; 
	$header = array(  );
	$header[' '] =array('style'=>'border-top:2px solid;border-bottom:2px solid;width:3%') ; 
	$header['kelompok'] =array('style'=>'border-top:2px solid;border-bottom:2px solid;width:37%') ; 
	$header['Hobi '] =array('style'=>'border-top:2px solid;border-bottom:2px solid;width:60%') ;  
	
	
	$row = array(); 
	$hobis = loaddata_hobi_karyawan($_GET['id']);
	$n=1;
	foreach($hobis as $ddata  ){
		 
		$row[] = array(
			'#'=> $n,  
			'tahun'=>  $ddata['label'] , 
			'penyk'=>ucfirst($ddata['nama_hobi']) ,   
		); $n++;
	}	
	$datas = table_cetak_rows($row);
	$view .= table_cetak_builder($header , $datas ,  3  );
	return $view;
}


function data_riwayat_kerja(){
	$view = ' '; 
	
	$header_kerja = array(
		' '=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:3%'),  
		'Nama perusahaan'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:36%'),  
		'Tahun'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:18%'),   
		'kota'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:15%'),   
		'bidang'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:28%'),   
	);
	$nk = 1;
	$rowkerja =array();
	$riwayat_kerjas = loaddata_pekerjaan_karyawan($_GET['id']);
	foreach($riwayat_kerjas as $riwayat_kerja  ){ 
		$rowkerja[] = array(
			'#'=> $nk,   
			'nama_perusahaan'=> strtoupper($riwayat_kerja['nama_perusahaan']),
			'tahun'			=> $riwayat_kerja['tahun_masuk']  .' s/d '. $riwayat_kerja['tahun_keluar'] ,
			'kota'			=> ucfirst($riwayat_kerja['lokasi_kerja'])   ,	
			'bidang'		=> strtoupper($riwayat_kerja['bidang_kerja']),  
			  
		); 
		$nk++;
	}  
	$dataker = table_cetak_rows($rowkerja);  
	$view = table_cetak_builder($header_kerja , $dataker ,  5 ,false ); 
	return $view;
}

function data_riwayat_pendidikan(){

	$header_pendidikan = array(
		' '=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:3%'), 
		'TH'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:7%'),   
		'Strata'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:15%'),  
		'Nama lembaga'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:24%'),  
		'Ijazah'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:18%'),  
		'N'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:5%'),  
		'Lokasi'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:15%'),   
		'KAT'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:12%'),   
	);
	$np=1;
	$rowpendidikans =array();
	$riwayat_pendidikans = loaddata_pendidikan_karyawan($_GET['id']);
	foreach($riwayat_pendidikans as $riwayat_pendidikan  ){ 
		$pend = my_get_data_by_id('pendidikan','pendidikan_id',$riwayat_pendidikan['pendidikan_id']);
		$rowpendidikans[] = array(
			'#'=> $np,  
			'tahun'=>   ucfirst($riwayat_pendidikan['tahun_masuk']),
			'strata'=>  strtoupper($pend['code']), 
			'nama_lembaga_pendidikan'=>  ucfirst($riwayat_pendidikan['nama_lembaga_pendidikan']),
			'ijazah'=>  ucfirst($riwayat_pendidikan['no_ijazah']),
			'nilai'=>  ucfirst($riwayat_pendidikan['nilai']),
			'kota'=>ucfirst($riwayat_pendidikan['lokasi_pendidikan'])   ,	
			'kategori'=>   strtoupper($riwayat_pendidikan['status_pendidikan']),  
			'pe'=>'&nbsp;', 
		); 
		$np++;
	}
	
	$datasccx = table_cetak_rows($rowpendidikans);  
	$view .= table_cetak_builder($header_pendidikan , $datasccx ,  7 ,false ); 
	return $view;
}

function data_keluarga(){
		$headercc = array(
		' '=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:3%'), 
		'nama'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:25%'),  
		'pekerjaan'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:20%'),  
		'usia'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:7%'),  
		'hubungan'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:13%'),   
		'pendidikan'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:13%'),   
		'tanggungan'=>array('style'=>'border-top:2px solid;border-bottom:2px solid;width:17%'),   
	);
	$ncc=1;
	$rowcc =array(); 
	$ddatascc = loaddata_keluarga_karyawan( $_GET['id'] ); 
	foreach($ddatascc as $ddatacc  ){ 
		$rowcc[] = array(
			'#'=> $ncc,  
			'nama'=>  ucfirst($ddatacc['nama']), 
			'job'=>  ucfirst($ddatacc['pekerjaan']), 
			'usia'=> getage(	$ddatacc['tanggal_lahir']  ),
			'hubungan'=>   ucfirst($ddatacc['label']),
			'pekerjaan'=>strtoupper($ddatacc['pendidikan_terakhir'])   ,	
			'pe'=>   ucfirst($ddatacc['tertanggung']),  
		); 
		$ncc++;
	} 
	 
	$datascc = table_cetak_rows($rowcc); 
	$view  = table_cetak_builder($headercc , $datascc ,  6,false ); 
	return $view;
}
?>
<style type="text/css">
<!--

	table.page_header {width: 100%; border: none; background-color: #CDCDCD; border-bottom: solid 1mm #000; padding: 2mm }
	table.page_footer {width: 100%; border: none;  border-top: solid 1mm #000; padding: 2mm}
div.zone
{
	border: solid 2mm #66AACC;
	border-radius: 3mm;
	padding: 1mm;
	background-color: #FFEEEE;
	color: #440000;
}
div.zone_over
{
	width: 30mm;
	height: 35mm;
	overflow: hidden;
}

-->
</style>
	
<page style="font-size: 12pt">
	<page_footer>
		<table class="page_footer">
			<tr>
				<td style="width: 33%; text-align: left;">
					 <?php echo $karyawan['nama'];?> 
				</td>
				<td style="width: 34%; text-align: center">
					page [[page_cu]]/[[page_nb]]
				</td>
				<td style="width: 33%; text-align: right">
					HRIS RSKM * MAP&copy;2010 - <?php echo date('Y'); ?>
				</td>
			</tr>
		</table>
	</page_footer>
	<div style="width: 100%; text-align:center; font-size: 14pt ;"><?php echo $karyawan['nama']; ?>   &nbsp; ( <?php echo  getage($karyawan['tanggal_lahir'])  ; ?>thn ) <br>
	
	<?php if(trim($karyawan['nik']) <> '' )echo '( NIP: '. strtoupper($karyawan['nik']) .' )';?></div>
	<br>
	<table style="width: 100%;" align="center">
		<tr>
		<?php if(file_exists($photo['upload_path']) ){ ?>
			<td style="vertical-align: top; padding: 2px; width: 25%; text-align: left;"><img style="border:1px solid #000" src="<?php echo $photo['upload_path']; ?>" alt="<?php echo $karyawan['nama'];?>" style="width:160px"></td>
		<?php }else{ ?>	
			<td style="vertical-align: top; padding: 2px; width: 25%; text-align: left;"><img style="border:1px solid #000" src="files/upload/sample_thumb.jpg" alt="<?php echo $karyawan['nama'];?>" style="width:160px"></td>
		<?php } ?>
			<td style="vertical-align: top; padding: 2px; width: 75%; text-align: left;"> 
				<b><i>Tempat, tanggal lahir</i> :</b>	<?php echo ucfirst($karyawan['tempat_lahir']).', '. strtoupper($karyawan['tanggal_lahir']); ?><br> <br> 
				<b><i>No. Identitas</i> :</b>&nbsp;	<?php echo strtoupper($karyawan['idcard']); ?><br><br> 
				<b><i>Jenis kelamin</i> :</b>&nbsp;	<?php echo strtoupper($karyawan['kelamin']); ?> , <b><i>Gol Darah</i> :</b> <?php echo $karyawan['gol_da']; ?><br><br> 
				<b><i>Status</i> :</b>&nbsp;	<?php echo strtoupper($karyawan['marital']); ?> ,
				<b><i>Agama</i> :</b>&nbsp;	<?php echo strtoupper($karyawan['agama']); ?><br><br> 
				<b><i>Email</i> :</b>&nbsp;	<?php echo strtolower($karyawan['email']); ?><br><br> 
				<b><i>No. Telp. Seluler / Rumah</i> :</b>&nbsp;	<?php echo strtoupper($karyawan['telepon_mobile']); ?> / <?php echo strtoupper($karyawan['telepon_rumah']); ?><br><br> 
				<b><i>Alamat (KTP)</i> :</b>&nbsp;	<br><?php echo  ($karyawan['alamat']); ?><br> 
				<b><i>Kota  </i> :</b>&nbsp;	<?php echo  ($karyawan['kota']); ?><br>  
				<b><i>Kodepos  </i> :</b>&nbsp;	<?php echo  ($karyawan['kodepos']); ?><br><br> 
				<b><i>Alamat tinggal</i> :</b>&nbsp;	<br><?php echo  ($karyawan['alamat_tinggal']); ?><br>  
				<b><i>Kota  </i> :</b>&nbsp;	<?php echo  ($karyawan['kota_tinggal']); ?><br> 
				<b><i>Kodepos  </i> :</b>&nbsp;	<?php echo  ($karyawan['kodepos_tinggal']); ?><br><br> 
			</td>
		</tr> 
	</table> 
	<br>   
	<div style="width: 100%; text-align:center; padding:2px; font-size: 13pt ;">RIWAYAT KERJA</div>
	<?php echo data_riwayat_kerja(); ?>  
	<div style="width: 100%; text-align:center; padding:2px; font-size: 13pt ;">RIWAYAT PENDIDIKAN</div>
	<?php echo data_riwayat_pendidikan(); ?> 
	<br>
</page>
<page style="font-size: 10pt">
	<page_footer>
		<table class="page_footer">
			<tr>
				<td style="width: 33%; text-align: left;">
					<?php echo $karyawan['nama'];?>
				</td>
				<td style="width: 34%; text-align: center">
					page [[page_cu]]/[[page_nb]]
				</td>
				<td style="width: 33%; text-align: right">
					M A P &copy; 2010 - <?php echo date('Y'); ?>
				</td>
			</tr>
		</table>
	</page_footer>

	<div style="width: 100%; text-align:center; padding:2px; font-size: 13pt ;">RIWAYAT KESEHATAN</div>
	<?php echo data_kesehatan(); ?>
	<div style="width: 100%; text-align:center; padding:2px; font-size: 13pt ;">MINAT DAN HOBI</div>
	<?php echo data_hobi() ; ?>
	<div style="width: 100%; text-align:center; padding:2px; font-size: 13pt ;">DATA KELUARGA</div>
	<?php echo data_keluarga(); ?>
</page>